/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package carshow;

import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableColumn;

/**
 *
 * @author Wayne
 */
public class AwardPrintFrame extends javax.swing.JFrame {

    String ClassScoreHeader = "Judging Winners by Class";
    String SpecialAwardHeader = "Award Winners";
    /**
     * Creates new form AwardPrintFrame
     */
    public AwardPrintFrame() {
        initComponents();
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        scoreHeader = new javax.swing.JLabel();
        scoreTable = new javax.swing.JTable();
        awardHeader = new javax.swing.JLabel();
        awardTable = new javax.swing.JTable();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);

        scoreHeader.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        scoreHeader.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        scoreHeader.setLabelFor(awardTable);
        scoreHeader.setText(this.ClassScoreHeader);

        scoreTable.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "Rank", "Owner", "Color", "Year", "Make", "Model", "Score"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }
        });
        scoreTable.setAutoscrolls(false);
        scoreTable.setShowVerticalLines(false);

        awardHeader.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        awardHeader.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        awardHeader.setLabelFor(scoreTable);
        awardHeader.setText(this.SpecialAwardHeader);
        awardHeader.setAlignmentY(0.1F);
        awardHeader.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);

        awardTable.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "Award", "Owner", "Color", "Year", "Make ", "Model"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }
        });
        awardTable.setAutoscrolls(false);
        awardTable.setShowVerticalLines(false);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(scoreHeader, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
            .addComponent(awardHeader, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(scoreTable, javax.swing.GroupLayout.PREFERRED_SIZE, 905, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(awardTable, javax.swing.GroupLayout.PREFERRED_SIZE, 905, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(0, 22, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(scoreHeader)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(scoreTable, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(awardHeader)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(awardTable, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(450, Short.MAX_VALUE))
        );

        for (int i = 0; i < scoreTable.getColumnModel().getColumnCount(); i++) {
            TableColumn column = scoreTable.getColumnModel().getColumn(i);
            if (i == 0) {
                column.setPreferredWidth(10); // narrow for entrant #, may drop this column someday
            }
            else if (i == 1) { // class mnemonic & desc, wide
                column.setPreferredWidth(140);
            }
            else if (i == 2) { // Name field
                column.setPreferredWidth(100);
            }
            else if (i == 3) { // year  - narrow to middling
                column.setPreferredWidth(30);
            }
            else if (i == 7) {
                column.setMaxWidth(40);
            }
            else {
                column.setPreferredWidth(70);
            }
        }
        for (int i = 0; i < awardTable.getColumnModel().getColumnCount(); i++) {
            TableColumn column = awardTable.getColumnModel().getColumn(i);
            if (i == 0) {
                column.setPreferredWidth(90); // empirical width for widest award name
                column.setResizable(true); // when resized by user
            }
            else if (i == 1) { // class mnemonic & desc, wide
                column.setPreferredWidth(140);
            }
            else if (i == 2) { // Name field
                column.setPreferredWidth(110);
            }
            else if (i == 3) { // year  - narrow to middling
                column.setPreferredWidth(50);
            }
            else {
                column.setPreferredWidth(70);
            }
        }

        pack();
    }// </editor-fold>//GEN-END:initComponents

    /**
     * get the table model for the Award table.
     * @return JTable model
     */
    public DefaultTableModel getAwardModel() {
        return (DefaultTableModel)awardTable.getModel();
    }
    
    /**
     * get the table model for the judging classes scores table.
     * @return JTable model
     */
    public DefaultTableModel getScoreModel() {
        return (DefaultTableModel)scoreTable.getModel();
    }
    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel awardHeader;
    protected javax.swing.JTable awardTable;
    private javax.swing.JLabel scoreHeader;
    private javax.swing.JTable scoreTable;
    // End of variables declaration//GEN-END:variables
}
